*****************************************
** ReplicationFile Ecker-Ehrhardt 2014 RIPE written "Do-file-mode"  :)
*****************************************

** you need "estout" for the tables 

ssc install estout


** Table 1

estimates drop _all

xi: nbreg n1000 lper1000 year i.country if year>1969 & pervote > 2 & year<2009, exposure(total2) cluster(party)
estimates store Model_1_1

xi: nbreg n1000 lper1000 rile2 ext2 pervote formincumb  GDPp year i.country if year>1969 & pervote > 2 & year<2009, exposure(total2) cluster(party)
estimates store Model_1_2

xi: nbreg n1000 lper1000 lnTrade fdi2 MigraFlow rile2 ext2 pervote formincumb  GDPp year i.country if year>1969 & pervote > 2 & year<2009, exposure(total2) cluster(party)
estimates store Model_1_3

xi: nbreg n1000 lper1000 allCOW1 rile2 ext2 pervote formincumb  GDPp year i.country if year>1969 & pervote > 2 & year<2009, exposure(total2) cluster(party)
estimates store Model_1_4

xi: nbreg n1000 lper1000 lnTrade fdi2 MigraFlow allCOW1 rile2 ext2 pervote formincumb GDPp year i.country if year>1969 & pervote > 2 & year<2009, exposure(total2) cluster(party)
estimates store Model_1_5

estout * using Ecker-Ehrhardt_RIPE_Table1.txt, replace style (tab) cells(b(star fmt(3)) se(par fmt(3))) stats(p chi2 alpha N) legend starlevels(# 0.10 * 0.05 ** 0.01 *** 0.001)



** Table 2

estimates drop _all

xi: reg pos1000 lpos1000 lnTrade fdi2 MigraFlow formincumb ext2 rile2 pervote GDPp year i.country if year>1969 & pervote > 2 & year<2009, cluster(party)
estimates store Model_2_1

xi: reg pos1000 lpos1000 lnTrade lTxpr fdi2 MigraFlow prot natmult formincumb ext6 rile6 pervote GDPp year i.country if year>1969 & pervote > 2 & year<2009, cluster(party)
estimates store Model_2_2

xi: reg pos1000 lpos1000 lnTrade fdi2 f2xpr MigraFlow prot natmult formincumb ext6 rile6 pervote GDPp year i.country if year>1969 & pervote > 2 & year<2009, cluster(party)
estimates store Model_2_3

xi: reg pos1000 lpos1000 lnTrade fdi2 MigraFlow MFxnm prot natmult formincumb ext6 rile6 pervote GDPp year i.country if year>1969 & pervote > 2 & year<2009, cluster(party)
estimates store Model_2_4

xi: reg pos1000 lpos1000 lnTrade lTxpr fdi2 f2xpr MigraFlow MFxnm prot natmult formincumb ext6 rile6 pervote GDPp year i.country if year>1969 & pervote > 2 & year<2009, cluster(party)
estimates store Model_2_5

estout * using Ecker-Ehrhardt_RIPE_Table2.txt, replace style (tab) cells(b(star fmt(3)) se(par fmt(3))) stats(F r2_a N, fmt(%9.3f %9.3g)) legend starlevels(# 0.10 * 0.05 ** 0.01 *** 0.001)


** Table 3


xi: reg pos1000 lpos1000 allCOW1 lnTrade fdi2 MigraFlow formincumb ext2 rile2 pervote GDPp year i.country if year>1969 & pervote > 2 & year<2009, cluster(party) 
estimates store Model_3_1

xi: reg pos1000 lpos1000 ei12 ei3n lnTrade fdi2 MigraFlow formincumb ext2 rile2 pervote GDPp year i.country if year>1969 & pervote > 2 & year<2009, cluster(party) 
estimates store Model_3_2

xi: reg pos1000 lpos1000 ei12 ei3n ei3nxnm ei3nxMdem3 natmult Mdem3 lnTrade fdi2 MigraFlow formincumb ext5 rile5 pervote GDPp year i.country if year>1969 & pervote > 2 & year<2009, cluster(party) 
estimates store Model_3_3

xi: reg posINT lposINT int12 int3n lnTrade fdi2 MigraFlow formincumb ext2  rile2 pervote GDPp year i.country if year>1969 & pervote > 2 & year<2009, cluster(party) 
estimates store Model_3_4

xi: reg posINT lposINT int12 int3n int3nxnm int3nxMdem3 natmult Mdem3 lnTrade fdi2 MigraFlow formincumb ext5  rile5 pervote GDPp year i.country if year>1969 & pervote > 2 & year<2009, cluster(party) 
estimates store Model_3_5

xi: reg posEU lposEU dEU lnTrade fdi2 MigraFlow e123e formincumb ext2  rile2 pervote GDPp year i.country if year>1969 & pervote > 2& EU12==1 & year<2009, cluster(party)
estimates store Model_3_6

xi: reg posEU lposEU dEU dEUxnm dEUxMdem3 natmult Mdem3 lnTrade fdi2 MigraFlow e123e formincumb ext5  rile5 pervote GDPp year i.country if year>1969 & pervote > 2& EU12==1 & year<2009, cluster(party)
estimates store Model_3_7


estout * using Ecker-Ehrhardt_RIPE_Table3.txt, replace style (tab) cells(b(star fmt(3)) se(par fmt(3))) stats(F r2_a N, fmt(%9.3f %9.3g)) legend starlevels(# 0.10 * 0.05 ** 0.01 *** 0.001)

drop _*


** qed *****************************************


